package com.unknownman.block.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lianziyou.chain.common.api.CommonPage;
import com.unknownman.block.entity.TContractConfig;
import com.unknownman.block.entity.TContractLogs;
import com.unknownman.block.entity.TTokenErc20;
import com.unknownman.block.vo.ERC20HourHoldVO;
import java.util.List;
import java.util.Map;
import org.cloud.vo.JavaBeanResultMap;


/**
 * <p>
 * ERC20代币持仓信息 服务类
 * </p>
 *
 * @author xhy
 * @since 2021-10-18
 */
public interface TTokenErc20Service extends IService<TTokenErc20> {


    public final String __ERC20_HOUR_HOLD_COLLECTION_NAME = "ERC20HourHoldCollection";

    /**
     * 查询ERC20代币持仓信息分页数据
     *
     * @param page  页码
     * @param limit 每页条数
     * @return CommonResult<TTokenErc20>
     */
    CommonPage<TTokenErc20> findListByPage(Integer page, Integer limit, String orderBy, QueryWrapper<TTokenErc20> queryWrapper);

    /**
     * 根据owner获取指定链的token持仓信息
     *
     * @param contractConfigId
     * @param owner
     * @return
     */
    TTokenErc20 getTokenByOwner(Long contractConfigId, String owner);

    /**
     * 根据log保存ERC20转账数据
     *
     * @param logs
     * @return
     */
    boolean saveByLog(TContractLogs logs, TContractConfig contractConfig);

    List<ERC20HourHoldVO> queryTokenErc20ByHour(String tokenAddress);

    void saveTokenErc20HourHold();

    List<JavaBeanResultMap> countTokenTotalByOwner(Map<String, Object> params);
}
